package ControlLayer;
import java.util.ArrayList;
import ModelLayer.*;
//model layer package has to be imported

/**
 * Controller class for the address book
 * 
 * @author (kbh) 
 * @version (2005.03.31)
 * (FEN): 2006.03.21: Some changes to the architecture in order to assure layering
 *                    and loose coupling
 */
public class AddressCtr
{
    
    //declare instance variables to reference containers
    public Person pCont;
    public Adressebog ABCont;
    
    
    
    public AddressCtr()
    {
    }
    
    //Dummy implementation: after implementing the model layer 
    //objects of class Person are to be returned, not String
    public String getPerson(int id)
    {
        //this method is to search the container for a person
        //with an id-number equal to the parameter id
        //when person is found, the method is to call print-methods in the TUI layer
        return "person";
    }
    
    
    public void createPerson(int id, String name, String city, String address, String postalCode, String phone)
    {   
       //creates a Person object and stores it in the container
       Person personObj = new Person(id, name, city, address, postalCode, phone);
       Adressebog.persons.add(personObj);
    }
    
    public void deletePerson(int id) 
    { 
    
    }
    
    public void updatePerson(int id)
    {
    }
    
    public ArrayList listAllPersons()
    {
    {
        System.out.println("people: ");

        for(Person person : ABCont.persons) {
            System.out.println(pCont.printname());
        }
        System.out.println();
          return null;
    }
}
}